{% extends "base_site.html" %}
{% block content %}
<link rel="stylesheet" href="/site_media/js/jquery_pagination/pagination.css" type="text/css" />
<script type="text/javascript" src='/site_media/js/jquery_pagination/jquery.pagination.js'></script>
<script type="text/javascript">
function pageSelected(page_id, jq) {
	$.get('/post/list/ajax/'+(page_id), {}, function(data) {
		$('#postlist').html(data);
	});
	return false; //防止直接跳转
}

$(document).ready(function() {
	// Create pagination element
	$("#pagination").pagination({{hits}}, {
		items_per_page: {{results_per_page}},
		num_edge_entries: 2,
		num_display_entries: 8,
		link_to: "/post/list/__id__",
		current_page: {{page}},
	    callback: pageSelected
	});
});
</script>
{% if post_list %}
	<div id='postlist'>
	{% include 'posts/post_list_template.html' %}
	</div>
	{% if is_paginated %}
		<div id='pagination' class='pagination'></div>
	{% endif %}
{% else %}
	<div class='entry'><h2>怎么了?看不到东西?你今天用Net搜索了吗?</h2></div>
{% endif %}
{% endblock %}